<html>
<head><meta charset="utf-8"><title>changing editions causes dependencies to rebuild · edition 2021 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/index.html">edition 2021</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html">changing editions causes dependencies to rebuild</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239485392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239485392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239485392">(May 19 2021 at 19:48)</a>:</h4>
<p>I'm still debugging, but I figured I might as well do it in public.</p>



<a name="239486234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239486234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239486234">(May 19 2021 at 19:54)</a>:</h4>
<p>The playground pre-builds all the dependencies in CI so that at user-code time we don't wait for minutes / hours. However, it looks like some of the dependencies change when we switch the edition:</p>
<div class="codehilite"><pre><span></span><code>% docker run -it --entrypoint bash rust-nightly

$ PLAYGROUND_EDITION=2018 modify-cargo-toml
$ touch src/main.rs
$ time cargo build
...
real    0m0.445s
user    0m0.362s
sys     0m0.091s
</code></pre></div>
<div class="codehilite"><pre><span></span><code>% docker run -it --entrypoint bash rust-nightly

$ PLAYGROUND_EDITION=2018 PLAYGROUND_FEATURE_EDITION2021=t modify-cargo-toml
$ touch src/main.rs
$ time cargo build
...
real    0m1.332s
user    0m1.066s
sys     0m0.265s
</code></pre></div>
<div class="codehilite"><pre><span></span><code>% docker run -it --entrypoint bash rust-nightly

$ PLAYGROUND_EDITION=2021 PLAYGROUND_FEATURE_EDITION2021=t modify-cargo-toml
$ touch src/main.rs
$ time cargo build
...
real    1m10.667s
user    3m57.861s
sys 0m19.246s
</code></pre></div>
<p>Of note is that this "only" rebuilds like 100 of the 436 dependencies.</p>



<a name="239486410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239486410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239486410">(May 19 2021 at 19:56)</a>:</h4>
<p>The <a href="https://gist.github.com/shepmaster/6032f162f1b0eb25e4bc107f247599c2">full list of built crates</a>. The head:</p>
<div class="codehilite"><pre><span></span><code>   Compiling proc-macro2 v1.0.26
   Compiling libc v0.2.94
   Compiling ppv-lite86 v0.2.10
   Compiling winapi v0.3.9
   Compiling tokio v1.6.0
   Compiling standback v0.2.17
   Compiling quote v1.0.9
</code></pre></div>



<a name="239488683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488683">(May 19 2021 at 20:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> That is likely due to the new resolver. It can cause some dependencies to be built separately with fewer features.  You may need to prepare the docker image with pre-built dependencies using different editions.</p>



<a name="239488802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488802">(May 19 2021 at 20:12)</a>:</h4>
<p>With edition at 2018, you can run <code>cargo fix --edition</code> to get a report of what will change.</p>



<a name="239488815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488815">(May 19 2021 at 20:12)</a>:</h4>
<p>Ah, it's on by default if you select edition 2021?</p>



<a name="239488826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488826">(May 19 2021 at 20:13)</a>:</h4>
<p>Yea</p>



<a name="239488857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488857">(May 19 2021 at 20:13)</a>:</h4>
<p>You can also turn it off by setting it to <code>resolver="1"</code></p>



<a name="239488881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488881">(May 19 2021 at 20:13)</a>:</h4>
<p>Couldn't I just enable it unconditionally?</p>



<a name="239488898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239488898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239488898">(May 19 2021 at 20:13)</a>:</h4>
<p>That works, too</p>



<a name="239489456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239489456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239489456">(May 19 2021 at 20:18)</a>:</h4>
<p>I'll let you know in 30+ minutes :-)</p>



<a name="239500475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/changing%20editions%20causes%20dependencies%20to%20rebuild/near/239500475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/changing.20editions.20causes.20dependencies.20to.20rebuild.html#239500475">(May 19 2021 at 21:46)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> that seems to have worked, thank you!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>